package org.raymond.iworks.study.basic.designpattern.state.money;

/**
 * @author raymond
 * @version V1.0
 * @Description: TODO
 */
class FeedbackState extends AbstractState {
    @Override
    public String getCurrentState() {
        return StateEnum.FEED_BACKED.getValue();
    }
}
class GenerateState extends AbstractState {
    @Override
    public void checkEvent(Context context) {
        context.setState(new ReviewState());
    }
    @Override
    public void checkFailEvent(Context context) {
        context.setState(new FeedbackState());
    }
    @Override
    public String getCurrentState() {
        return StateEnum.GENERATE.getValue();
    }
}
class NotPayState extends AbstractState {
    @Override
    public String getCurrentState() {
        return StateEnum.NOT_PAY.getValue();
    }

    @Override
    public void payOrderEvent(Context context) {
    }

    @Override
    public void feedbackEvent(Context context) {
    }
}
class PaidState extends AbstractState {
    @Override
    public String getCurrentState() {
        return StateEnum.PAID.getValue();
    }

    @Override
    public void feedbackEvent(Context context) {
    }
}
class PublishState extends AbstractState {
    @Override
    public String getCurrentState() {
        return StateEnum.PUBLISH.getValue();
    }

    @Override
    public void acceptOrderEvent(Context context) {
        // 当前状态改为下一个状态
        // 下一个状态是哪一个,根据流程图决定
        context.setState(new NotPayState());
    }

    @Override
    public void noPeopleAcceptEvent(Context context) {
        context.setState(new FeedbackState());
    }
}
class ReviewState extends AbstractState {
    @Override
    public String getCurrentState() {
        return StateEnum.REVIEW.getValue();
    }

    @Override
    public void makePriceEvent(Context context) {
        context.setState(new PublishState());
    }
}
